#include <hxcpp.h>

#ifndef INCLUDED_Hash
#include <Hash.h>
#endif
#ifndef INCLUDED_JClass
#include <JClass.h>
#endif
#ifndef INCLUDED_JClassField
#include <JClassField.h>
#endif
#ifndef INCLUDED_JConstant
#include <JConstant.h>
#endif
#ifndef INCLUDED_JField
#include <JField.h>
#endif
#ifndef INCLUDED_JObject
#include <JObject.h>
#endif
#ifndef INCLUDED_JVM
#include <JVM.h>
#endif
#ifndef INCLUDED_JValue
#include <JValue.h>
#endif
#ifndef INCLUDED_haxe_Log
#include <haxe/Log.h>
#endif
#ifndef INCLUDED_haxe_Public
#include <haxe/Public.h>
#endif

Void JObject_obj::__construct()
{
{
	HX_SOURCE_POS("Source/JObject.hx",7)
	this->fields = Array_obj< ::JField >::__new();
	HX_SOURCE_POS("Source/JObject.hx",8)
	this->w = false;
	HX_SOURCE_POS("Source/JObject.hx",9)
	this->type = HX_CSTRING("java/lang/Object");
}
;
	return null();
}

JObject_obj::~JObject_obj() { }

Dynamic JObject_obj::__CreateEmpty() { return  new JObject_obj; }
hx::ObjectPtr< JObject_obj > JObject_obj::__new()
{  hx::ObjectPtr< JObject_obj > result = new JObject_obj();
	result->__construct();
	return result;}

Dynamic JObject_obj::__Create(hx::DynamicArray inArgs)
{  hx::ObjectPtr< JObject_obj > result = new JObject_obj();
	result->__construct();
	return result;}

hx::Object *JObject_obj::__ToInterface(const type_info &inType) {
	if (inType==typeid( ::haxe::Public_obj)) return operator ::haxe::Public_obj *();
	return super::__ToInterface(inType);
}

Void JObject_obj::init( ::JClass c){
{
		HX_SOURCE_PUSH("JObject_obj::init")
		HX_SOURCE_POS("Source/JObject.hx",12)
		int _g = (int)0;
		Array< ::JClassField > _g1 = c->cfields;
		HX_SOURCE_POS("Source/JObject.hx",12)
		while(((_g < _g1->length))){
			HX_SOURCE_POS("Source/JObject.hx",12)
			::JClassField f = _g1->__get(_g);
			HX_SOURCE_POS("Source/JObject.hx",12)
			++(_g);
			HX_SOURCE_POS("Source/JObject.hx",13)
			::String nm = ::JVM_obj::toNativeValue(::JVM_obj::toValue(c->const_pool->__get(f->name_index),null()));
			HX_SOURCE_POS("Source/JObject.hx",14)
			::String ty = ::JVM_obj::toNativeValue(::JVM_obj::toValue(c->const_pool->__get(f->descriptor_index),null()));
			HX_SOURCE_POS("Source/JObject.hx",15)
			int af = f->access_flags;
			HX_SOURCE_POS("Source/JObject.hx",16)
			this->fields->push(::JField_obj::__new(nm,ty,af));
		}
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC1(JObject_obj,init,(void))

::String JObject_obj::toString( ){
	HX_SOURCE_PUSH("JObject_obj::toString")
	HX_SOURCE_POS("Source/JObject.hx",28)
	return this->type;
}


HX_DEFINE_DYNAMIC_FUNC0(JObject_obj,toString,return )

::JField JObject_obj::getField( ::JConstant cn){
	HX_SOURCE_PUSH("JObject_obj::getField")
	HX_SOURCE_POS("Source/JObject.hx",32)
	::JClass c = ::JVM_obj::classes->get(this->type);
	HX_SOURCE_POS("Source/JObject.hx",33)
	Dynamic n = null();
	Dynamic t = null();
	HX_SOURCE_POS("Source/JObject.hx",34)
	{
::JConstant _switch_1 = (cn);
		switch((_switch_1)->GetIndex()){
			case 10: {
				int ta = _switch_1->__Param(1);
				int na = _switch_1->__Param(0);
{
					HX_SOURCE_POS("Source/JObject.hx",36)
					n = ::JVM_obj::toNativeValue(::JVM_obj::toValue(c->const_pool->__get(na),c->const_pool));
					HX_SOURCE_POS("Source/JObject.hx",37)
					t = ::JVM_obj::toNativeValue(::JVM_obj::toValue(c->const_pool->__get(ta),c->const_pool));
				}
			}
			;break;
			default: {
				HX_SOURCE_POS("Source/JObject.hx",38)
				hx::Throw (HX_CSTRING("Invalid field reference"));
			}
		}
	}
	HX_SOURCE_POS("Source/JObject.hx",40)
	{
		HX_SOURCE_POS("Source/JObject.hx",40)
		int _g = (int)0;
		Array< ::JField > _g1 = this->fields;
		HX_SOURCE_POS("Source/JObject.hx",40)
		while(((_g < _g1->length))){
			HX_SOURCE_POS("Source/JObject.hx",40)
			::JField f = _g1->__get(_g);
			HX_SOURCE_POS("Source/JObject.hx",40)
			++(_g);
			HX_SOURCE_POS("Source/JObject.hx",41)
			::haxe::Log_obj::trace(f->type,hx::SourceInfo(HX_CSTRING("JObject.hx"),41,HX_CSTRING("JObject"),HX_CSTRING("getField")));
			HX_SOURCE_POS("Source/JObject.hx",42)
			::haxe::Log_obj::trace(n,hx::SourceInfo(HX_CSTRING("JObject.hx"),42,HX_CSTRING("JObject"),HX_CSTRING("getField")));
			HX_SOURCE_POS("Source/JObject.hx",43)
			::haxe::Log_obj::trace(t,hx::SourceInfo(HX_CSTRING("JObject.hx"),43,HX_CSTRING("JObject"),HX_CSTRING("getField")));
		}
	}
	HX_SOURCE_POS("Source/JObject.hx",45)
	return null();
}


HX_DEFINE_DYNAMIC_FUNC1(JObject_obj,getField,return )


JObject_obj::JObject_obj()
{
}

void JObject_obj::__Mark(HX_MARK_PARAMS)
{
	HX_MARK_BEGIN_CLASS(JObject);
	HX_MARK_MEMBER_NAME(type,"type");
	HX_MARK_MEMBER_NAME(fields,"fields");
	HX_MARK_MEMBER_NAME(w,"w");
	HX_MARK_END_CLASS();
}

void JObject_obj::__Visit(HX_VISIT_PARAMS)
{
	HX_VISIT_MEMBER_NAME(type,"type");
	HX_VISIT_MEMBER_NAME(fields,"fields");
	HX_VISIT_MEMBER_NAME(w,"w");
}

Dynamic JObject_obj::__Field(const ::String &inName,bool inCallProp)
{
	switch(inName.length) {
	case 1:
		if (HX_FIELD_EQ(inName,"w") ) { return w; }
		break;
	case 4:
		if (HX_FIELD_EQ(inName,"type") ) { return type; }
		if (HX_FIELD_EQ(inName,"init") ) { return init_dyn(); }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"fields") ) { return fields; }
		break;
	case 8:
		if (HX_FIELD_EQ(inName,"toString") ) { return toString_dyn(); }
		if (HX_FIELD_EQ(inName,"getField") ) { return getField_dyn(); }
	}
	return super::__Field(inName,inCallProp);
}

Dynamic JObject_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
	switch(inName.length) {
	case 1:
		if (HX_FIELD_EQ(inName,"w") ) { w=inValue.Cast< bool >(); return inValue; }
		break;
	case 4:
		if (HX_FIELD_EQ(inName,"type") ) { type=inValue.Cast< ::String >(); return inValue; }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"fields") ) { fields=inValue.Cast< Array< ::JField > >(); return inValue; }
	}
	return super::__SetField(inName,inValue,inCallProp);
}

void JObject_obj::__GetFields(Array< ::String> &outFields)
{
	outFields->push(HX_CSTRING("type"));
	outFields->push(HX_CSTRING("fields"));
	outFields->push(HX_CSTRING("w"));
	super::__GetFields(outFields);
};

static ::String sStaticFields[] = {
	String(null()) };

static ::String sMemberFields[] = {
	HX_CSTRING("type"),
	HX_CSTRING("fields"),
	HX_CSTRING("w"),
	HX_CSTRING("init"),
	HX_CSTRING("toString"),
	HX_CSTRING("getField"),
	String(null()) };

static void sMarkStatics(HX_MARK_PARAMS) {
};

static void sVisitStatics(HX_VISIT_PARAMS) {
};

Class JObject_obj::__mClass;

void JObject_obj::__register()
{
	Static(__mClass) = hx::RegisterClass(HX_CSTRING("JObject"), hx::TCanCast< JObject_obj> ,sStaticFields,sMemberFields,
	&__CreateEmpty, &__Create,
	&super::__SGetClass(), 0, sMarkStatics, sVisitStatics);
}

void JObject_obj::__boot()
{
}

